Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EuiDataGrid] Fixed focus ring to be contained in cell #5194

Merged
merged 5 commits into from
Sep 16, 2021

Conversation

miukimiu
Copy link
Contributor

@miukimiu miukimiu commented Sep 16, 2021

Summary

This PR fixes the EuiDataGrid focus ring to be contained in the cell. It also fixes cells when focused getting a higher z-index which was causing long content to overlap surrounding cells.

The issue with the focus states was found on #4958.

Why contained focus rings?

As we can see having the focus rings outside of the cells was making them getting cut by other surrounding cells. IMO it was not looking good.

data-grid-focus-ring@2x

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • [ ] Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • [ ] Props have proper autodocs and playground toggles
  • [ ] Added documentation
  • [ ] Checked Code Sandbox works for any docs examples
  • [ ] Added or updated jest tests
  • [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@@ -13,6 +13,7 @@
position: relative;
align-items: center;
display: flex;
overflow: hidden;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and I don't see a problem of having this overflow: hidden; for .euiDataGridRowCell. Am I missing something? Does it impact any use case?

In practice having it or not having it is almost the same. But the focus ring now that is contained looks a little bit better with the overflow: hidden:

datagrid-overflow-hidden@2x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I could tell, the cell contents itself already has overflow: hidden so I doubt this should have an impact. It certainly should not with the normal/default settings.

@miukimiu miukimiu marked this pull request as ready for review September 16, 2021 12:11
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5194/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM! I tested in Chrome, FF & Safari (there were some other quirks but not related to this PR). So glad to have this fixed!

Comment on lines +59 to +60
&::after {
content: '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first I was worried about adding a pseudo element because I was told that extra elements can impact the performance, but because this is only add on focus it doesn't seem to have an impact. 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++ that I'm not overly concerned about the performance and I think this is just fine, but wanted to add that we can use an inset box-shadow to get a border inside (vs. outside) the cell if it ever becomes a perf issue: CodeSandbox demo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @constancecchen! 🎉

At some point, I added the inset box-shadow to the cell. But then I couldn't use a border-radius because the cell has some light gray non-rounded borders. Then I just decided to add a pseudo-element. So this way we can have a rounded focus ring inside the non-rounded cell. 😅

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh right, makes sense if we want that border-radius!

src/components/datagrid/_mixins.scss Outdated Show resolved Hide resolved
@@ -13,6 +13,7 @@
position: relative;
align-items: center;
display: flex;
overflow: hidden;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I could tell, the cell contents itself already has overflow: hidden so I doubt this should have an impact. It certainly should not with the normal/default settings.

Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5194/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants